/* Simple Class to Plot RB stats 
   Author: O. van der Aa 
   Commit test
   Email: o.van-der-aa@imperial.ac.uk */
using namespace std;
#ifndef RBPlot_h
#define RBPlot_h

#include <TROOT.h>
#include <TCut.h>
#include <vector>


class TTree;


class RBPlot {
	public:
		RBPlot(TTree* tree);
		RBPlot(char* filename);
		void doNJobsCEVO(char* sdate,char* edate,TCut cuts="",char* hname="default");
		void doJobEffi(char* sdate, char* edate,Int_t nbins,TCut cuts="",char* hname="default");
		void doJobRunTime(char* sdate,char* edate,Int_t nbins,TCut cuts="",char* hname="default"); 
		void graph(char* var,char* sdate,char* edate,Int_t dt,TCut cuts="",char* hname="default",char* yname="N", char* xname="Time",char* title="");
		void totalJobs(char* sdate,char* edate,Int_t dt,TCut cuts,char* hname);
		void totalHours(char* sdate,char* edate,Int_t dt,TCut cuts,char* hname);
		void usefullEffi(char* sdate,char* edate,TCut cut,char* filename=NULL); 
		void usefullEffibyVAR(char* var,char* sdate,char* edate,TCut cut,char* filename=NULL);
		void totalTimeVO(char* sdate,char* edate,TCut cut);
		void totalTimeCE(char* sdate,char* edate,TCut cut); 
		void printIntervalEpoch(char* sdate,char* edate);
		void activeDN(char* sdate,char* edate,Int_t dt,TCut cut,char* hname); 
		void jobRBCEMatrix(char* sdate, char* edate,TCut cuts,char* hname); 
		void integratedJobs(char* sdate,char* edate,Int_t dt,TCut cuts,char* hname);
		void activeJobs(char* sdate,char* edate,Int_t dt,TCut andcut,char* list="alice$VO.fData==\"alice\" atlas$VO.fData==\"atlas\" cms$VO.fData==\"cms\" lhcb$VO.fData==\"lhcb\" other$!(VO.fData==\"lhcb\"||VO.fData==\"alice\"||VO.fData==\"atlas\"||VO.fData==\"cms\")");
		void cumulative(char* variable,char* weight,Int_t nbins, Float_t xmin, Float_t xmax,char* tx,char* ty,char* ty1,char* cuts="1",char* hname="cumulative",Int_t r=1);
	protected:
		pair<UInt_t,UInt_t> getInterval(char* sdate,char* edate);
		Int_t getNBins(pair<UInt_t,UInt_t> interval,Int_t time);
	private:
		TTree* mytree;
		TFile* myfile;

};

#endif
